<!--
 * @Descripttion: 换房
 * @version: 1.0
 * @Author: 狸猫
 * @Date: 2023-11-25 14:29:36
 * @LastEditors: 狸猫
 * @LastEditTime: 2023-12-05 10:08:42
-->
<template>
  <div class="content">
    <el-dialog
      :title="title"
      :visible.sync="visible"
      width="800px"
      append-to-body
      :before-close="close"
    >
      <el-descriptions title="预订信息">
        <el-descriptions-item label="预定人"
          >罗先生/男/13233445566</el-descriptions-item
        >
        <el-descriptions-item label="预定人证件号"
          >343434454567789900</el-descriptions-item
        >
        <el-descriptions-item label="订单总额">345元</el-descriptions-item>
        <el-descriptions-item label="原预定房间"
          >红枫小区A栋1单元1202号</el-descriptions-item
        >
      </el-descriptions>
      <el-form :model="form" :inline="true">
        <el-form-item label="更换的房间">
          <el-select v-model="form.houseId" placeholder="请选择">
            <el-option
              v-for="item in options"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="close">取 消</el-button>
        <el-button type="primary" @click="onSubmit">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
import { changeHouse } from "@/api/order/order";
export default {
  name: "changeHouse",
  props: {
    visible: {
      type: Boolean,
      default: false,
    },
    orderInfo: {
      type: Object,
      default: {},
    },
  },
  data() {
    return {
      options: [
        {
          value: "选项1",
          label: "1",
        },
        {
          value: "选项2",
          label: "2",
        },
        {
          value: "选项3",
          label: "3",
        },
        {
          value: "选项4",
          label: "4",
        },
      ],
      title: "变更预定房间",
      form: {
        orderId: "1",
        houseId: "",
      },
    };
  },
  methods: {
    onSubmit() {
      this.form.orderId = this.orderInfo.orderId;
      changeHouse(this.form).then((res) => {
        this.close();
      });
    },
    close() {
      this.$emit("closeeldialog");
    },
  },
};
</script>
<style lang="sasss" scoped></style>
